<?php
    //$sidebar = $this->requestAction('block/sidebar/ra');
    $controller_name = $this->params['controller'];
?>
<div class="box-left zhigh">
		<div class="logo2">
			<a class="lg" href="<?php echo $this->General->base_url() ?>"><img src="<?php echo $this->webroot ?><?php echo $settings['logo_website'] ?>"/></a>
		<div class="banner mobile">
			<a href="#"><img src="<?php echo $this->webroot . $settings['banner_website'] ?>"/></a>
		</div>
		</div>
		<div class="ctn-top-mobile">
    		<div class="nav-menu nav-menu-mobile">
    			<a onclick="openMenu()" class="menu_all_cate menu-link" href="javascript:void(0);"><?php $this->General->translate('all_categories') ?> <img src="<?php echo $this->webroot ?>images/menu_down.png" style="width: 13px; position: relative; top: 2px; margin-left:10px"></a>
    			<div class="bg-yl"><span></span></div>
    			
                <div class="navigation-container" id="menu-desktop">
    				
    				<ul class="main-menu">
                        <!--
    					<li color = "">
    						<a href="<?php echo $this->General->base_url() ?>" class="home">
    							<img src="<?php echo $this->webroot ?>images/home-yl.png"/>
    						</a>
    					</li>
                        -->
                        <?php
                            foreach($main_menu as $menu)
                            {
                                
                                $has_sub = !empty($menu['sub_menu']) ? 'class="has-sub"' : '';
                                $other = $menu['menu']['other'];
                                $arr_color = explode('|', $other);
                                $bg_color = (isset($arr_color[0]) && @$arr_color[0]) != '' ? $arr_color[0] : '00A790';
                                $text_color = isset($arr_color[1]) ? $arr_color[1] : '000000';
                                
                        ?>
    					<li <?php echo $has_sub ?> color = "<?php echo $bg_color ?>" textcolor="<?php echo $text_color ?>">
    						
                        <?php
                            if($menu['image']['name'] != ''){
                        ?>
                                <a href="<?php echo $this->General->base_url() . $menu['menu_desc']['link'] ?>"><img style="width: 15px; height: 13px;" src="<?php echo $this->webroot . $menu['image']['name'] ?>" /></a>
                        <?php 
                            }
                            else{
                        ?>
                                <a href="<?php echo $this->General->base_url() . $menu['menu_desc']['link'] ?>"><?php echo $menu['menu_desc']['title'] ?></a>
                        <?php
                            }
    
                            if($has_sub != '')
                            {
                                echo '<ul class="sub">';
                                foreach($menu['sub_menu'] as $m)
                                {
                                    $has_sub = !empty($m['sub_menu']) ? 'class="has-sub"' : '';
                        ?>
                                    <li <?php echo $has_sub ?>><a href="<?php echo $this->General->base_url() . $m['menu_desc']['link'] ?>"><?php echo $m['menu_desc']['title'] ?></a>  
                        <?php
                                    if($has_sub != '')
                                    {
                                        echo '<ul class="sub">';
                                        foreach($m['sub_menu'] as $me)
                                        {
                        ?>
                                            <li><a href="<?php echo $this->General->base_url() . $me['menu_desc']['link'] ?>"><?php echo $me['menu_desc']['title'] ?></a></li>
                        <?php
                                        }
                                        echo '</ul>';
                                        echo '</li>';
                                    }
                                }
                                echo '</ul>';
                                
                            }
                            echo '</li>';
                            }
                        ?>
    				</ul>
    			</div>
                
       
                
                
       
                <!--MENU MOBILE-->
                <!--
                <a class="menu-link" href="#menu-mobile">Menu</a>
		        -->
        		<nav id="menu-mobile" class="menu-mobile">
        			<ul>
                        <?php
                            foreach($main_menu as $menu)
                            {
                                
                                $has_sub = !empty($menu['sub_menu']) ? 'class="has-submenu"' : '';
                                $other = $menu['menu']['other'];
                                $arr_color = explode('|', $other);
                                $bg_color = (isset($arr_color[0]) && @$arr_color[0]) != '' ? $arr_color[0] : '00A790';
                                $text_color = isset($arr_color[1]) ? $arr_color[1] : '000000';
                                
                        ?>
        	        	<li <?php echo $has_sub ?>  color="<?php echo $bg_color ?>"><a href="<?php echo $this->General->base_url() . $menu['menu_desc']['link'] ?>"><?php echo $menu['menu_desc']['title'] ?></a>
   		                <?php
                            if($has_sub != '')
                            {
                                echo '<ul class="sub-menu">';
                                foreach($menu['sub_menu'] as $m)
                                {
                                    $has_sub = !empty($m['sub_menu']) ? 'class="has-submenu"' : '';
                        ?>
        	        			 <li <?php echo $has_sub ?>><a href="<?php echo $this->General->base_url() . $m['menu_desc']['link'] ?>"><?php echo $m['menu_desc']['title'] ?></a>
        	        			 <?php
                                    if($has_sub != '')
                                    {
                                        echo '<ul>';
                                        foreach($m['sub_menu'] as $me)
                                        {
                                ?>
                                        <li><a href="<?php echo $this->General->base_url() . $me['menu_desc']['link'] ?>"><?php echo $me['menu_desc']['title'] ?></a></li>
                                <?php
                                        }
                                        echo '</ul>';
                                    }
                                    echo '</li>';
                               }
                               echo '</ul>'; 
                            }
                            echo '</li>';
                            }
                        ?>
        	        </ul>
        		</nav>                                
                
                <script>
                jQuery( document ).ready( function( $ ) {
                
                	var $menu = $('#menu-mobile'),
                	  $menulink = $('.menu-link'),
                	  $menuTrigger = $('.has-submenu > a');
                
                	$menulink.click(function(e) {
                		e.preventDefault();
                		$menulink.toggleClass('active');
                		$menu.toggleClass('active');
                	});
                
                	$menuTrigger.click(function(e) {
                		e.preventDefault();
                		var $this = $(this);
                		$this.toggleClass('active').next('ul').toggleClass('active');
                	});
                
                });
                </script>
                                
                                                                                                
                
                
                
                
                
                
                                                                                                                                                                
    		</div>
            <div class="top-mobile">
                <div class="title">
                    <ul class="breadcrumbs">
                        <li><a href="<?php echo $this->General->base_url() ?>"><img style="position: relative; top: 2px;" src="<?php echo $this->webroot ?>images/home-yl-2.png" /></a></li>
                        <?php
                            foreach($breadcrumbs as $breadcrumb)
                            {
                                echo '<li><a href="'.$this->General->base_url().$breadcrumb['link'].'">'.$breadcrumb['title'].'</a></li>';
                            }
                        ?>
                    </ul>
    			</div>
                <div class="clear"></div>
                <div class="box-color box-color-mobile">
            		<div class="type-1"></div>
            		<div class="type-2"></div>
            		<div class="type-3"></div>
            		<div class="type-4"></div>
            	</div>
            </div>
        </div>
		<div class="clear"></div>
            <?php
                if(isset($header_menu_sidebar))
                {
            ?>
		    <div class="navigation-container-2" >
                <?php
                    $base_url = $this->General->base_url();
                ?>
		    	<div class="txt-menu-active">
					<a href="<?php echo $base_url. $header_menu_sidebar['link'] . $has_html ?>"><span><?php echo $header_menu_sidebar['title'] ?></span></a>
				</div>
                <input type="hidden" name="cate_code_active" value="<?php echo @$cate_code_active ?>" />
				<ul class="main-menu-2">
                    <?php
                        $j = 0;
                        foreach($menu_sidebar as $menu)
                        {
                            $link = $base_url . $header_menu_sidebar['link'] .'/'. $menu['link']['link'] . $has_html;
                            $has_sub = !empty($menu['sub_category']) ? 'class="has-sub"' : '';
                            $other = $menu['category']['other'];
                            $txt_color = $other != '' ? $other : '00A790';
                    ?>
					<li <?php echo $has_sub ?> color = "<?php echo $txt_color; ?>">
						<a href="<?php echo $link ?>" class="parent" linkto = "<?php echo $menu['link']['link'];?>"><?php echo $menu['category_desc']['title'] ?></a>
                    <?php
                        if($has_sub != '')
                        {
                            echo '<ul class="sub">';
                            foreach($menu['sub_category'] as $m)
                            {
                                $link = $base_url . $header_menu_sidebar['link'] .'/'. $m['link']['link'] . $has_html;
                                $has_sub = !empty($m['sub_category']) ? 'class="has-sub"' : '';
                    ?>
                                <li <?php echo $has_sub ?>><a href="<?php echo $link ?>" linkto = "<?php echo $m['link']['link'];?>"><?php echo $m['category_desc']['title'] ?></a>  
                    <?php
                                if($has_sub != '')
                                {
                                    echo '<ul class="sub">';
                                    foreach($m['sub_category'] as $me)
                                    {
                                        $link = $base_url . $header_menu_sidebar['link'] .'/'. $me['link']['link'] . $has_html;
                    ?>
                                        <li><a href="<?php echo $link ?>" linkto = "<?php echo $me['link']['link'];?>"><?php echo $me['category_desc']['title'] ?></a></li>
                    <?php
                                    }
                                    echo '</ul>';
                                    echo '</li>';
                                }
                            }
                            echo '</ul>';
                            
                        }
                        echo '</li>';
                        }
                    ?>
				</ul>
			</div>
            <?php
                }
            ?>
	</div>